package com.yxb.square.mapper;

import java.util.List;

import com.yxb.common.core.page.TableDataInfo;
import com.yxb.square.domain.TutoringSquare;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 家教广场Mapper接口
 * 
 * @author 林德炫
 * @date 2025-03-28
 */
public interface TutoringSquareMapper 
{
    /**
     * 查询家教广场
     * 
     * @param requestId 家教广场主键
     * @return 家教广场
     */
    public TutoringSquare selectTutoringSquareByRequestId(Long requestId);

    /**
     * 查询家教广场列表
     * 
     * @param tutoringSquare 家教广场
     * @return 家教广场集合
     */
    public List<TutoringSquare> selectTutoringSquareList(TutoringSquare tutoringSquare);


//    获取已接单的列表
    public List<TutoringSquare> selectListByStatus(TutoringSquare tutoringSquare);

    /**
     * 新增家教广场
     * 
     * @param tutoringSquare 家教广场
     * @return 结果
     */
    public int insertTutoringSquare(TutoringSquare tutoringSquare);

    /**
     * 修改家教广场
     * 
     * @param tutoringSquare 家教广场
     * @return 结果
     */
    public int updateTutoringSquare(TutoringSquare tutoringSquare);

    /**
     * 删除家教广场
     * 
     * @param requestId 家教广场主键
     * @return 结果
     */
    public int deleteTutoringSquareByRequestId(Long requestId);

    /**
     * 批量删除家教广场
     * 
     * @param requestIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTutoringSquareByRequestIds(Long[] requestIds);

    @Select("select * from tutoring_square where name = #{userName}")
    List<TutoringSquare> listSquareByUserName(String userName);

    //获取教员接单（我的接单）
    @Select({
            "<script>",
                "SELECT * FROM tutoring_square WHERE teacher_name = #{teacherName}",
                "<if test='name != null and name != \"\"'>",
                    " AND name LIKE CONCAT('%', #{name}, '%')",
                "</if>",
            "</script>"
    })
    List<TutoringSquare> listSquareByTeacher(@Param("teacherName") String teacherName,  @Param("name") String name);

    //获取家长发布（我的发布）
    @Select({
            "<script>",
            "SELECT * FROM tutoring_square WHERE name = #{parentName}",
            "<if test='status != null and status != \"\"'> AND status = #{status} </if>",
            "</script>"
    })
    List<TutoringSquare> listSquareByParent(@Param("parentName") String parentName, @Param("status") String status);
}
